package com.future.mayi.utils.imageselectcache;

import android.content.Context;
import android.net.Uri;
import android.widget.ImageView;

import com.imnjh.imagepicker.ImageLoader;
import com.future.mayi.app.App;
import com.future.mayi.utils.HCUtils;

/**
 * Created by Administrator on 2018/3/9.
 */

public class SelectImageLoader  implements ImageLoader {

    @Override
    public void bindImage(ImageView imageView, Uri uri, int width, int height) {
        String url = uri.getPath();
        if (url != null && (!url.contains("http")))
            url = "file://".concat(url);
        HCUtils.loadWebImg(App.getmContext(), imageView, url);
    }

    @Override
    public void bindImage(ImageView imageView, Uri uri) {
        String url = uri.getPath();
        if (url != null && (!url.contains("http")))
            url = "file://".concat(url);
        HCUtils.loadWebImg(App.getmContext(), imageView, url);
    }

    @Override
    public ImageView createImageView(Context context) {
        ImageView imageView = new ImageView(context);
        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        return imageView;
    }

    @Override
    public ImageView createFakeImageView(Context context) {
        return new ImageView(context);
    }
}